package com.nd.te.prepare;


import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class global implements Writable {
    private int iyear;
    private int imonth ;
    private String country;
    private String region;
    private String province;
    private String city;
    private String latitude;
    private String longitude;
    private int attack;

//    public  global(){
//        this.iyear = 1970;
//        this.imonth = 1;
//        this.country = "Dominican Republic";
//        this.region = "Central America & Caribbean";
//        this.province = "National";
//        this.city = "National";
//        this.latitude = "18.456792";
//        this.longitude = "-69.951164";
//        this.attack = 1;
//    }
    public int getIyear() {
        return iyear;
    }

    public int getImonth() {
        return imonth;
    }

    public String getCountry() {
        return country;
    }

    public String getRegion() {
        return region;
    }

    public String getProvince() {
        return province;
    }

    public String getCity() {
        return city;
    }

    public String getLatitude() {
        return latitude;
    }

    public String getLongitude() {
        return longitude;
    }

    public int getAttack() {
        return attack;
    }

    public void setIyear(int iyear) {
        this.iyear = iyear;
    }

    public void setImonth(int imonth) {
        this.imonth = imonth;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    public void set(int iyear,int imonth,String country,String region, String province,String city, String latitude, String longitude, int attack){
        this.iyear = iyear;
        this.imonth = imonth;
        this.country = country;
        this.region = region;
        this.province = province;
        this.city = city;
        this.latitude = latitude;
        this.longitude = longitude;
        this.attack = attack;
    }

    public String toString(){
        return iyear+","
                +imonth+","
                +country+","
                +region+","
                +province+","
                +city+","
                +latitude+","
                +longitude+","
                +attack;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(iyear);
        out.writeInt(imonth);
        out.writeUTF(country);
        out.writeUTF(region);
        out.writeUTF(province);
        out.writeUTF(city);
        out.writeUTF(latitude);
        out.writeUTF(longitude);
        out.writeInt(attack);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.iyear = in.readInt();
        this.imonth = in.readInt();
        this.country = in.readUTF();
        this.region = in.readUTF();
        this.province = in.readUTF();
        this.city = in.readUTF();
        this.latitude = in.readUTF();
        this.longitude = in.readUTF();
        this.attack = in.readInt();
    }
}
